FROM python:3.9-alpine
MAINTAINER sivan@syuee.com
ENV TZ "Asiz/Shanghai"

# 这里要指定目录 ， 主要用于docker-compose
ADD ./server /home/syuee/server
WORKDIR /home/syuee/server 
RUN sed -i 's/106.54.79.212/syuee-db/' models.py
RUN sed -i 's/127.0.0.1/syuee-redis/' cache.py

RUN echo https://mirrors.ustc.edu.cn/alpine/latest-stable/main > /etc/apk/repositories; \
    echo https://mirrors.ustc.edu.cn/alpine/latest-stable/community >> /etc/apk/repositories



RUN \ 
apk update && \
apk add --no-cache gcc make libc-dev linux-headers uwsgi-python3 && \
pip3 install --upgrade pip && \
pip3 install  uwsgi && \
pip3 install  -r /home/syuee/server/requirements.txt  

#RUN uwsgi --ini /home/syuee/server/syuee-docker.ini


EXPOSE 8082

CMD ["/usr/local/bin/uwsgi", "--ini", "/home/syuee/server/syuee-docker.ini"]



#RUN echo https://mirrors.ustc.edu.cn/alpine/v3.8/main > /etc/apk/repositories; \
#    echo https://mirrors.ustc.edu.cn/alpine/v3.8/community >> /etc/apk/repositories



#RUN \
#apk update && \ 
#apk add --no-cache vim  python3 uwsgi uwsgi-python3 && \ 
#ln -s /usr/bin/python3 /usr/bin/python && \ 
#ln -s /usr/bin/pip3 /usr/bin/pip && \ 
#python -m pip install --upgrade pip && \ 


#CMD ["/usr/local/bin/uwsgi", "--http", " 8082" , "--wsgi-file", "wsgi.py"]
